package cn.com.nes.site.action.project;

import cn.com.nes.common.util.DBUtils;
import cn.com.nes.site.entity.DataReq;
import cn.com.nes.site.entity.DataRes;
import cn.com.nes.site.entity.PageData;
import cn.com.nes.site.module.service.ProjectService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller("project")
@RequestMapping("/project")
public class ProjectAction {
	
	@Resource
	private ProjectService service;

	@RequestMapping(method = RequestMethod.POST, value = "/addProject")
	public @ResponseBody  PageData addProject(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
			DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
			PageData res = new PageData() ;
			if (req_Status.getRetCode() != 0) {
				res = new PageData();
				res.setRetCode(req_Status.getRetCode()) ;
				res.setRetMessage(req_Status.getRetMessage());
				return res;
			}	
			DataReq req = req_Status.getReq() ;
			res = service.addProject(req) ;
			return res;
	}
	
	@RequestMapping(method = RequestMethod.POST, value = "/deleteProject")
	public @ResponseBody  PageData deleteProject(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
			DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
			PageData res = new PageData() ;
			if (req_Status.getRetCode() != 0) {
				res = new PageData();
				res.setRetCode(req_Status.getRetCode()) ;
				res.setRetMessage(req_Status.getRetMessage());
				return res;
			}	
			DataReq req = req_Status.getReq() ;
			req.getReqData().put("tableName", "t_project");
			req.getReqData().put("keys", "uuid");
			res = service.deleteData(req) ;
			return res;
	}
	
	@RequestMapping(method = RequestMethod.POST, value = "/updateProjectAuditStatus")
	public @ResponseBody  PageData updateProjectAuditStatus(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
			DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
			PageData res = new PageData() ;
			if (req_Status.getRetCode() != 0) {
				res = new PageData();
				res.setRetCode(req_Status.getRetCode()) ;
				res.setRetMessage(req_Status.getRetMessage());
				return res;
			}	
			DataReq req = req_Status.getReq() ;
			req.getReqData().put("tableName", "t_project");
			req.getReqData().put("keys", "uuid");
			res = service.updateProjectAuditStatus(req) ;
			return res;
	}
	
	@RequestMapping(method = RequestMethod.POST, value = "/sendProjectOvertimeRemind")
	public @ResponseBody  PageData sendProjectOvertimeRemind(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
			DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
			PageData res = new PageData() ;
			if (req_Status.getRetCode() != 0) {
				res = new PageData();
				res.setRetCode(req_Status.getRetCode()) ;
				res.setRetMessage(req_Status.getRetMessage());
				return res;
			}	
			DataReq req = req_Status.getReq() ;
			res = service.sendProjectOvertimeRemind(req) ;
			return res;
	}
	
	@RequestMapping(method = RequestMethod.POST, value = "/addProjectCheck")
	public @ResponseBody  PageData addProjectCheck(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
			DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
			PageData res = new PageData() ;
			if (req_Status.getRetCode() != 0) {
				res = new PageData();
				res.setRetCode(req_Status.getRetCode()) ;
				res.setRetMessage(req_Status.getRetMessage());
				return res;
			}	
			DataReq req = req_Status.getReq() ;
			res = service.addProjectCheck(req) ;
			return res;
	}
	
	@RequestMapping(method = RequestMethod.POST, value = "/addBulidLog")
	public @ResponseBody  PageData addBulidLog(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
			DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
			PageData res = new PageData() ;
			if (req_Status.getRetCode() != 0) {
				res = new PageData();
				res.setRetCode(req_Status.getRetCode()) ;
				res.setRetMessage(req_Status.getRetMessage());
				return res;
			}	
			DataReq req = req_Status.getReq() ;
			res = service.addBulidLog(req) ;
			return res;
	}
	
	@RequestMapping(method = RequestMethod.POST, value = "/getBulidList")
	public @ResponseBody  PageData getBulidList(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
			DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
			PageData res = new PageData() ;
			if (req_Status.getRetCode() != 0) {
				res = new PageData();
				res.setRetCode(req_Status.getRetCode()) ;
				res.setRetMessage(req_Status.getRetMessage());
				return res;
			}	
			DataReq req = req_Status.getReq() ;
			res = service.getBulidList(req) ;
			return res;
	}
	
	@RequestMapping(method = RequestMethod.POST, value = "/addProjectScheduling")
	public @ResponseBody  PageData addProjectScheduling(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
			DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
			PageData res = new PageData() ;
			if (req_Status.getRetCode() != 0) {
				res = new PageData();
				res.setRetCode(req_Status.getRetCode()) ;
				res.setRetMessage(req_Status.getRetMessage());
				return res;
			}	
			DataReq req = req_Status.getReq() ;
			res = service.addProjectScheduling(req) ;
			return res;
	}
	
	@RequestMapping(method = RequestMethod.POST, value = "/getProjectHomePage")
	public @ResponseBody  PageData getProjectHomePage(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
			DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
			PageData res = new PageData() ;
			if (req_Status.getRetCode() != 0) {
				res = new PageData();
				res.setRetCode(req_Status.getRetCode()) ;
				res.setRetMessage(req_Status.getRetMessage());
				return res;
			}	
			DataReq req = req_Status.getReq() ;
			res = service.getProjectHomePage(req) ;
			return res;
	}
	
	@RequestMapping(method = RequestMethod.POST, value = "/getProgressOverview")
	public @ResponseBody  PageData getProgressOverview(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
			DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
			PageData res = new PageData() ;
			if (req_Status.getRetCode() != 0) {
				res = new PageData();
				res.setRetCode(req_Status.getRetCode()) ;
				res.setRetMessage(req_Status.getRetMessage());
				return res;
			}	
			DataReq req = req_Status.getReq() ;
			res = service.getProgressOverview(req) ;
			return res;
	}
	
	//获取项目列表
	@RequestMapping(method = RequestMethod.POST, value = "/getProjectList")
	public @ResponseBody  PageData getProjectList(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
			DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
			PageData res = new PageData() ;
			if (req_Status.getRetCode() != 0) {
				res = new PageData();
				res.setRetCode(req_Status.getRetCode()) ;
				res.setRetMessage(req_Status.getRetMessage());
				return res;
			}	
			DataReq req = req_Status.getReq() ;
			res = service.getProjectList(req) ;
			return res;
	}
	
	//获取指定时间内排期的项目列表
	@RequestMapping(method = RequestMethod.POST, value = "/getSchedulingList")
	public @ResponseBody  PageData getSchedulingList(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
			DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
			PageData res = new PageData() ;
			if (req_Status.getRetCode() != 0) {
				res = new PageData();
				res.setRetCode(req_Status.getRetCode()) ;
				res.setRetMessage(req_Status.getRetMessage());
				return res;
			}	
			DataReq req = req_Status.getReq() ;
			res = service.getSchedulingList(req) ;
			return res;
	}
	
	//获取排期之后的项目，工单列表
	@RequestMapping(method = RequestMethod.POST, value = "/getAllocatedList")
	public @ResponseBody  PageData getAllocatedList(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
			DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
			PageData res = new PageData() ;
			if (req_Status.getRetCode() != 0) {
				res = new PageData();
				res.setRetCode(req_Status.getRetCode()) ;
				res.setRetMessage(req_Status.getRetMessage());
				return res;
			}	
			DataReq req = req_Status.getReq() ;
			res = service.getAllocatedList(req) ;
			return res;
	}
	
	@RequestMapping(method = RequestMethod.POST, value = "/getInstallUsers")
	public @ResponseBody  PageData getInstallUsers(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
			DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
			PageData res = new PageData() ;
			if (req_Status.getRetCode() != 0) {
				res = new PageData();
				res.setRetCode(req_Status.getRetCode()) ;
				res.setRetMessage(req_Status.getRetMessage());
				return res;
			}	
			DataReq req = req_Status.getReq() ;
			res = service.getInstallUsers(req) ;
			return res;
	}
	
	@RequestMapping(method = RequestMethod.POST, value = "/addWorkOrder")
	public @ResponseBody  PageData addWorkOrder(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
			DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
			PageData res = new PageData() ;
			if (req_Status.getRetCode() != 0) {
				res = new PageData();
				res.setRetCode(req_Status.getRetCode()) ;
				res.setRetMessage(req_Status.getRetMessage());
				return res;
			}	
			DataReq req = req_Status.getReq() ;
			res = service.addWorkOrder(req) ;
			return res;
	}
	
	
	//用户派单
	@RequestMapping(method = RequestMethod.POST, value = "/orderDispatch")
	public @ResponseBody  PageData orderDispatch(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
			DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
			PageData res = new PageData() ;
			if (req_Status.getRetCode() != 0) {
				res = new PageData();
				res.setRetCode(req_Status.getRetCode()) ;
				res.setRetMessage(req_Status.getRetMessage());
				return res;
			}	
			DataReq req = req_Status.getReq() ;
			
			String contact = (String)req.getReqData().get("contact") ;
			String contact_phone = (String)req.getReqData().get("contact_phone") ;
			String maintain_id = (String)req.getReqData().get("maintain_id") ;
			String work_order_id = (String)req.getReqData().get("work_order_id") ;
			
			if(StringUtils.isEmpty(contact)) {
				res.setRetCode(9) ;
				res.setRetMessage("联系人不能为空");
				return res;
			} 
			if(StringUtils.isEmpty(contact_phone)) {
				res.setRetCode(9) ;
				res.setRetMessage("联系电话不能为空");
				return res;
			} 
			
			if(StringUtils.isEmpty(maintain_id)) {
				res.setRetCode(9) ;
				res.setRetMessage("安装人员不能为空");
				return res;
			} 
			
			if(StringUtils.isEmpty(work_order_id)) {
				res.setRetCode(9) ;
				res.setRetMessage("工单编号不能为空");
				return res;
			} 
			
			req.getReqData().put("status", "02") ;
			req.getReqData().put("describe", "派遣工单") ;
			res = service.changeOrderStatus(req) ;
			return res;
	}
	
	
	//用户接单
	@RequestMapping(method = RequestMethod.POST, value = "/orderReceiving")
	public @ResponseBody  PageData orderReceiving(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
			DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
			PageData res = new PageData() ;
			if (req_Status.getRetCode() != 0) {
				res = new PageData();
				res.setRetCode(req_Status.getRetCode()) ;
				res.setRetMessage(req_Status.getRetMessage());
				return res;
			}	
			DataReq req = req_Status.getReq() ;
			
			String work_order_id = (String)req.getReqData().get("work_order_id") ;
			
			if(StringUtils.isEmpty(work_order_id)) {
				res.setRetCode(9) ;
				res.setRetMessage("工单编号不能为空");
				return res;
			} 
			
			req.getReqData().put("status", "04") ;
			req.getReqData().put("describe", "已接单") ;
			req.getReqData().put("maintain_id", req.getUinfo().getId()) ;
			res = service.changeOrderStatus(req) ;
			return res;
	}
	
	//用户拒单
	@RequestMapping(method = RequestMethod.POST, value = "/orderRefuse")
	public @ResponseBody  PageData orderRefuse(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
		DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
		PageData res = new PageData() ;
		if (req_Status.getRetCode() != 0) {
			res = new PageData();
			res.setRetCode(req_Status.getRetCode()) ;
			res.setRetMessage(req_Status.getRetMessage());
			return res;
		}	
		DataReq req = req_Status.getReq() ;
		
		String work_order_id = (String)req.getReqData().get("work_order_id") ;
		
		if(StringUtils.isEmpty(work_order_id)) {
			res.setRetCode(9) ;
			res.setRetMessage("工单编号不能为空");
			return res;
		} 
		
		req.getReqData().put("status", "03") ;
		req.getReqData().put("describe", "已拒单") ;
		req.getReqData().put("maintain_id", req.getUinfo().getId()) ;
		res = service.changeOrderStatus(req) ;
		return res;
	}
	
	//维修人员到达
	@RequestMapping(method = RequestMethod.POST, value = "/orderArrived")
	public @ResponseBody  PageData orderArrived(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
		DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
		PageData res = new PageData() ;
		if (req_Status.getRetCode() != 0) {
			res = new PageData();
			res.setRetCode(req_Status.getRetCode()) ;
			res.setRetMessage(req_Status.getRetMessage());
			return res;
		}	
		DataReq req = req_Status.getReq() ;
		
		String work_order_id = (String)req.getReqData().get("work_order_id") ;
		String longitude = (String)req.getReqData().get("longitude") ;
		String latitude = (String)req.getReqData().get("latitude") ;
		
		if(StringUtils.isEmpty(work_order_id)) {
			res.setRetCode(9) ;
			res.setRetMessage("工单编号不能为空");
			return res;
		} 
		
		if(StringUtils.isEmpty(longitude)) {
			res.setRetCode(9) ;
			res.setRetMessage("经度不能为空");
			return res;
		} 
		
		if(StringUtils.isEmpty(latitude)) {
			res.setRetCode(9) ;
			res.setRetMessage("纬度不能为空");
			return res;
		} 
		
		req.getReqData().put("status", "05") ;
		req.getReqData().put("describe", "已到达") ;
		req.getReqData().put("maintain_id", req.getUinfo().getId()) ;
		res = service.changeOrderStatus(req) ;
		return res;
	}
	
	//安装完成
	@RequestMapping(method = RequestMethod.POST, value = "/orderFinished")
	public @ResponseBody  PageData orderFinished(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
		DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
		PageData res = new PageData() ;
		if (req_Status.getRetCode() != 0) {
			res = new PageData();
			res.setRetCode(req_Status.getRetCode()) ;
			res.setRetMessage(req_Status.getRetMessage());
			return res;
		}	
		DataReq req = req_Status.getReq() ;
		
		String work_order_id = (String)req.getReqData().get("work_order_id") ;
		if(StringUtils.isEmpty(work_order_id)) {
			res.setRetCode(9) ;
			res.setRetMessage("工单编号不能为空");
			return res;
		} 
		
		
		
		req.getReqData().put("status", "06") ;
		req.getReqData().put("describe", "已完成") ;
		req.getReqData().put("maintain_id", req.getUinfo().getId()) ;
		res = service.changeOrderStatus(req) ;
		return res;
	}

	//获取工单列表
	@RequestMapping(method = RequestMethod.POST, value = "/getWorkOrderList")
	public @ResponseBody  PageData getWorkOrderList(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
		DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
		PageData res = new PageData() ;
		if (req_Status.getRetCode() != 0) {
			res = new PageData();
			res.setRetCode(req_Status.getRetCode()) ;
			res.setRetMessage(req_Status.getRetMessage());
			return res;
		}	
		DataReq req = req_Status.getReq() ;
		res = service.getWorkOrderList(req) ;
		return res;
	}
	
	//获取工单记录列表
	@RequestMapping(method = RequestMethod.POST, value = "/getWorkOrderRecordList")
	public @ResponseBody  PageData getWorkOrderRecordList(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
		DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
		PageData res = new PageData() ;
		if (req_Status.getRetCode() != 0) {
			res = new PageData();
			res.setRetCode(req_Status.getRetCode()) ;
			res.setRetMessage(req_Status.getRetMessage());
			return res;
		}	
		DataReq req = req_Status.getReq() ;
		res = service.getWorkOrderRecordList(req) ;
		return res;
	}
	
	//获取商机列表
	@RequestMapping(method = RequestMethod.POST, value = "/getOpportunityList")
	public @ResponseBody  PageData getOpportunityList(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
		DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
		PageData res = new PageData() ;
		if (req_Status.getRetCode() != 0) {
			res = new PageData();
			res.setRetCode(req_Status.getRetCode()) ;
			res.setRetMessage(req_Status.getRetMessage());
			return res;
		}	
		DataReq req = req_Status.getReq() ;
		res = service.getOpportunityList(req) ;
		return res;
	}	
	
	@RequestMapping(method = RequestMethod.POST, value = "/getProjectCheckList")
	public @ResponseBody  PageData getProjectCheckList(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
		DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
		PageData res = new PageData() ;
		if (req_Status.getRetCode() != 0) {
			res = new PageData();
			res.setRetCode(req_Status.getRetCode()) ;
			res.setRetMessage(req_Status.getRetMessage());
			return res;
		}	
		DataReq req = req_Status.getReq() ;
		res = service.getProjectCheckList(req) ;
		return res;
	}	
	
	@RequestMapping(method = RequestMethod.POST, value = "/getLogList")
	public @ResponseBody  PageData getLogList(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
		DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
		PageData res = new PageData() ;
		if (req_Status.getRetCode() != 0) {
			res = new PageData();
			res.setRetCode(req_Status.getRetCode()) ;
			res.setRetMessage(req_Status.getRetMessage());
			return res;
		}	
		DataReq req = req_Status.getReq() ;
		res = service.getLogList(req) ;
		return res;
	}
	
	@RequestMapping(method = RequestMethod.POST, value = "/getVisualization")
	public @ResponseBody  PageData getVisualization(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
		DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
		PageData res = new PageData() ;
		if (req_Status.getRetCode() != 0) {
			res = new PageData();
			res.setRetCode(req_Status.getRetCode()) ;
			res.setRetMessage(req_Status.getRetMessage());
			return res;
		}	
		DataReq req = req_Status.getReq() ;
		res = service.getVisualization(req) ;
		return res;
	}
	
	@RequestMapping(method = RequestMethod.POST, value = "/getProjectfileList")
    public @ResponseBody
    PageData getProjectfileList(HttpServletRequest request,
                      HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        DataReq req = req_Status.getReq() ;
        res = service.getProjectfileList(req) ;
        return res;
    }
	
    @RequestMapping(method = RequestMethod.POST, value = "/saveProjectFile")
    public @ResponseBody
    PageData saveProjectFile(HttpServletRequest request,
                      HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        DataReq req = req_Status.getReq() ;
        res = service.saveProjectFile(req) ;
        return res;
    }
    
    @RequestMapping(method = RequestMethod.POST, value = "/delProjectFile")
    public @ResponseBody
    PageData delProjectFile(HttpServletRequest request,
                      HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        DataReq req = req_Status.getReq() ;
        res = service.delProjectFile(req) ;
        return res;
    }
	
    
    @RequestMapping(method = RequestMethod.POST, value = "/addOpeDev")
    public @ResponseBody
    PageData addOpeDev(HttpServletRequest request,
                      HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        DataReq req = req_Status.getReq() ;
        res = service.addOpeDev(req) ;
        return res;
    }
    
    @RequestMapping(method = RequestMethod.POST, value = "/getWeather")
    public @ResponseBody
    PageData getWeather(HttpServletRequest request,
                      HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        DataReq req = req_Status.getReq() ;
        res = service.getWeather(req) ;
        return res;
    }
    
    @RequestMapping(method = RequestMethod.GET, value = "/getPreWeatherList")
    public @ResponseBody
    PageData getPreWeatherList(HttpServletRequest request,
                      HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,false);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        DataReq req = req_Status.getReq() ;
        res = service.getPreWeatherList(req) ;
        return res;
    }
    
    @RequestMapping(method = RequestMethod.POST, value = "/userSign")
    public @ResponseBody
    PageData userSign(HttpServletRequest request,
                      HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        DataReq req = req_Status.getReq() ;
        res = service.userSign(req) ;
        return res;
    }
    
    @RequestMapping(method = RequestMethod.POST, value = "/getSignList")
    public @ResponseBody
    PageData getSignList(HttpServletRequest request,
                      HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        DataReq req = req_Status.getReq() ;
        res = service.getSignList(req) ;
        return res;
    }
    
    @RequestMapping(method = RequestMethod.POST, value = "/getSignObjectList")
    public @ResponseBody
    PageData getSignObjectList(HttpServletRequest request,
                      HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        DataReq req = req_Status.getReq() ;
        res = service.getSignObjectList(req) ;
        return res;
    }
    
    @RequestMapping(method = RequestMethod.POST, value = "/projectReport")
    public @ResponseBody
    PageData projectReport(HttpServletRequest request,
                      HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        DataReq req = req_Status.getReq() ;
        res = service.projectReport(req) ;
        return res;
    }
    
    @RequestMapping(method = RequestMethod.POST, value = "/getProjectReportList")
    public @ResponseBody
    PageData getProjectReportList(HttpServletRequest request,
                      HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        DataReq req = req_Status.getReq() ;
        res = service.getProjectReportList(req) ;
        return res;
    }
    
    @RequestMapping(method = RequestMethod.POST, value = "/getPointData")
    public @ResponseBody
    PageData getPointData(HttpServletRequest request,
                      HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        DataReq req = req_Status.getReq() ;
        res = service.getPointData(req) ;
        return res;
    }
    
    @RequestMapping(method = RequestMethod.POST, value = "/getLevelParam")
    public @ResponseBody
    PageData getLevelParam(HttpServletRequest request,
                      HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        DataReq req = req_Status.getReq() ;
        res = service.getLevelParam(req) ;
        return res;
    }
    
    
    @RequestMapping(method = RequestMethod.POST, value = "/addPointsRule")
    public @ResponseBody
    PageData addPointsRule(HttpServletRequest request,
                      HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        DataReq req = req_Status.getReq() ;
        res = service.addPointsRule(req) ;
        return res;
    }
    
    @RequestMapping(method = RequestMethod.POST, value = "/getRuleList")
    public @ResponseBody
    PageData getRuleList(HttpServletRequest request,
                      HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        DataReq req = req_Status.getReq() ;
        res = service.getRuleList(req) ;
        return res;
    }
    
	@RequestMapping(method = RequestMethod.POST, value = "/deleteRule")
	public @ResponseBody  PageData deleteRule(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
			DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
			PageData res = new PageData() ;
			if (req_Status.getRetCode() != 0) {
				res = new PageData();
				res.setRetCode(req_Status.getRetCode()) ;
				res.setRetMessage(req_Status.getRetMessage());
				return res;
			}	
			DataReq req = req_Status.getReq() ;
			req.getReqData().put("tableName", "t_user_points_rule");
			req.getReqData().put("keys", "uuid");
			res = service.deleteData(req) ;
			return res;
	}
	
	@RequestMapping(method = RequestMethod.POST, value = "/getPointList")
	public @ResponseBody  PageData getPointList(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
			DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
			PageData res = new PageData() ;
			if (req_Status.getRetCode() != 0) {
				res = new PageData();
				res.setRetCode(req_Status.getRetCode()) ;
				res.setRetMessage(req_Status.getRetMessage());
				return res;
			}	
			DataReq req = req_Status.getReq() ;
			res = service.getPointList(req) ;
			return res;
	}
	@RequestMapping(method = RequestMethod.POST, value = "/audituserPoint")
	public @ResponseBody  PageData audituserPoint(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
			DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
			PageData res = new PageData() ;
			if (req_Status.getRetCode() != 0) {
				res = new PageData();
				res.setRetCode(req_Status.getRetCode()) ;
				res.setRetMessage(req_Status.getRetMessage());
				return res;
			}	
			DataReq req = req_Status.getReq() ;
			res = service.audituserPoint(req) ;
			return res;
	}
	
	@RequestMapping(method = RequestMethod.POST, value = "/addUserPosition")
	public @ResponseBody  PageData addUserPosition(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
			DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
			PageData res = new PageData() ;
			if (req_Status.getRetCode() != 0) {
				res = new PageData();
				res.setRetCode(req_Status.getRetCode()) ;
				res.setRetMessage(req_Status.getRetMessage());
				return res;
			}	
			DataReq req = req_Status.getReq() ;
			res = service.addUserPosition(req) ;
			return res;
	}
	
	@RequestMapping(method = RequestMethod.POST, value = "/saveProjectReportShzt")
	public @ResponseBody  PageData saveProjectReportShzt(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
			DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
			PageData res = new PageData() ;
			if (req_Status.getRetCode() != 0) {
				res = new PageData();
				res.setRetCode(req_Status.getRetCode()) ;
				res.setRetMessage(req_Status.getRetMessage());
				return res;
			}	
			DataReq req = req_Status.getReq() ;
			res = service.saveProjectReportShzt(req) ;
			return res;
	}
	
	@RequestMapping(method = RequestMethod.POST, value = "/getDevList")
	public @ResponseBody  PageData getDevList(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
			DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
			PageData res = new PageData() ;
			if (req_Status.getRetCode() != 0) {
				res = new PageData();
				res.setRetCode(req_Status.getRetCode()) ;
				res.setRetMessage(req_Status.getRetMessage());
				return res;
			}	
			DataReq req = req_Status.getReq() ;
			res = service.getDevList(req) ;
			return res;
	}
	@RequestMapping(method = RequestMethod.POST, value = "/installDev")
	public @ResponseBody  PageData installDev(HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) throws Exception {
			DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
			PageData res = new PageData() ;
			if (req_Status.getRetCode() != 0) {
				res = new PageData();
				res.setRetCode(req_Status.getRetCode()) ;
				res.setRetMessage(req_Status.getRetMessage());
				return res;
			}	
			DataReq req = req_Status.getReq() ;
			res = service.installDev(req) ;
			return res;
	}
	
}
